home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / disktime.zip / MAXCYL.PAS < prev    next >
Pascal/Delphi Source File  |  1985-11-02  |  1KB  |  46 lines

  1. Procedure MaxCyl(Var Drive,CylMax:Integer);
  2. {
  3.     This procedure determines how many cylinders are on the specified drive
  4.  
  5.     Input        Drive    Integer specifying drive to test
  6.  
  7.     Output       MaxCyl   Number of usable cylinders on specified Drive
  8.  
  9.     Strategy     (1)      Request bios to interrogate disk controller and
  10.                           find the highest cylinder on the hard disk drive
  11.  
  12.                  (2)      Increment to get total number of usable cylinders
  13.  
  14.                  (3)      Write cylinder count for user
  15.  
  16. }
  17. Type
  18.     Result=Record
  19.                  Ax,Bx,Cx,Dx,Bp,Si,Di,Ds,Es,Flags:Integer;
  20.     End;
  21. Var
  22.    Sys:Result;
  23. Begin
  24.      SYS.AX:=$8*$0100+$01 { AH=8 means get parameters, AL=sector };
  25.      SYS.CX:=$0*$0100+$01 { CH=Cylinder, CL=Sector };
  26.      SYS.DX:=$0*$0100+$80+drive { DH=head, DL=$80+Drive };
  27.      Intr($13,Sys);
  28.      If Odd(Sys.Flags) then
  29.         begin
  30.              NormVideo;
  31.              Writeln('Error finding maximum cylinder on drive ',Drive);
  32.              Halt;
  33.         End;
  34.  
  35.      CylMax:=Hi(Sys.Cx)+(Lo(Sys.Cx) Div $40)*$0100;
  36.  
  37.      CylMax:=CylMax+1;
  38.  
  39.      LowVideo;
  40.      Write('   ..Found ');
  41.      NormVideo;
  42.      Write(CylMax);
  43.      LowVideo;
  44.      Write(' cylinders.  ');
  45.  
  46. End;